﻿package com.wxsoft.business.physic.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import com.wxsoft.business.model.easyui.PageHelper;
import com.wxsoft.business.physic.dao.IPsPhysicInHeadDao;
import com.wxsoft.business.physic.pojo.PsPhysicInHead;
import com.wxsoft.business.physic.service.IPsPhysicInHeadService;
import com.wxsoft.util.wx.UUIDUtil;

@Service("psPhysicInHeadService")
public class PsPhysicInHeadServiceImpl implements IPsPhysicInHeadService  {
	@Resource
	private IPsPhysicInHeadDao dao;
	
	
	public long findCount(PsPhysicInHead psPhysicInHead) {
		return dao.findCount(psPhysicInHead);
	}
	
	public List<PsPhysicInHead> findAll(PageHelper page,PsPhysicInHead psPhysicInHead) {
        List<PsPhysicInHead> r = dao.findAll(page,psPhysicInHead);
		return r;
	}
	public List<PsPhysicInHead> getBy(PsPhysicInHead psPhysicInHead) {
        List<PsPhysicInHead> r = dao.getBy(psPhysicInHead);
		return r;
	}
	@Transactional(readOnly = false, propagation = Propagation.REQUIRES_NEW)
	public String add(PsPhysicInHead psPhysicInHead) {
		psPhysicInHead.setId(UUIDUtil.getUUID());
		int r = this.dao.insert(psPhysicInHead);
		if(r==1){
			return "操作成功!";
		}
		return "操作失败!";
	}
	
	public String modify(PsPhysicInHead psPhysicInHead) {
		int r = this.dao.modify(psPhysicInHead);
		if(r==1){
			return "操作成功!";
		}
		return "操作失败!";
	}
	
	public String delete(PsPhysicInHead psPhysicInHead) {
		int r = this.dao.delete(psPhysicInHead);
		if(r==1){
			return "操作成功!";
		}
		return "操作失败!";
	}
	
}
